﻿//-----------------------------------------------------------------------
// <copyright file="Frame.cs" company="tuliprules.org">
//     Copyright (c) 2011 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the Frame class.</summary>
//-----------------------------------------------------------------------
namespace Tulip.Rules.Models.Rif.Prd
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Xml.Serialization;

    /// <summary>
    /// Represents a Frame formula.
    /// </summary>
    [Serializable]
    [DesignerCategory(@"code")]
    [XmlType(AnonymousType = true, Namespace = "http://www.w3.org/2007/rif#")]
    [XmlRoot(Namespace = "http://www.w3.org/2007/rif#", IsNullable = false)]
    public class Frame : Irimeta, IRifPrdElement
    {
        /// <summary>
        /// The object field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private object objectField;

        /// <summary>
        /// The slot field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private List<SlotFrameType> slotsField;

        /// <summary>
        /// Initializes a new instance of the <see cref="Frame"/> class. 
        /// </summary>
        public Frame()
        {
            this.slotsField = new List<SlotFrameType>();
        }

        /// <summary>
        /// Gets or sets a Member/Frame role, containing a TERM or an 
        /// object description.
        /// </summary>
        [XmlElement("object", Order = 0)]
        public object Object
        {
            get
            {
                return this.objectField;
            }

            set
            {
                this.objectField = value;
            }
        }

        /// <summary>
        /// Gets or sets a list of Atom/Expr or Frame slot roles, with 
        /// ordered="yes" attribute, containing a Name or TERM followed 
        /// by a TERM.
        /// </summary>
        [XmlElement("slot", Order = 1)]
        public List<SlotFrameType> Slots
        {
            get
            {
                return this.slotsField;
            }

            set
            {
                this.slotsField = value;
            }
        }
    }
}
